1. Field of Invention
The invention relates to a decoding device and a decoding method thereof and, in particular, to a decoding device and a decoding method thereof, which have multi-buffers for performing data-write and data-read operations simultaneously during an inverse scan stage.
2. Related Art
Video compression technology has been developed rapidly in the recent years. To decode and display the compressed video more quickly and correctly, many powerful decoding devices have been produced.
For example, in so-called MPEG or H.24X standard, a source video is compressed by means of a serial of processes, such as motion compensation, frequency transformation, quantization, scan, and variable-length encoding (VLC), etc. Herein, the frequency transformation is implemented by using a well-known discrete cosine transform (DCT) or discrete wavelet transform (DWT).
After transforming the source video into a frequency domain, the frequency coefficients of the source video are quantized and scanned. Because those high frequency coefficients usually contribute less influence on the video quality, which indicates that they are adaptive to remove for reducing the video size. Thereafter, a VLC compression is performed to compress the remaining frequency coefficients so as to compress the source video completely.
In addition, when restoring a compressed video, a variable-length decoding (VLD) and an inverse scan function are performed firstly. Thereafter, an inverse discrete cosine transform (IDCT) or inverse discrete wavelet transform (IDWT) is performed.
FIG. 1 shows a conventional decoding device 1 including a variable-length decoder (VLD) 11, a buffer 12, and a DC/AC predictor 13. In this case, the VLD 11 receives a compressed media stream 111, and then decodes and stores a block 121 from the compressed media stream 111. Because the block 121 is compressed by following a specific video standard during a data-compression stage, the VLD 11 may perform an inverse scan function (e.g. zigzag scan) to store the coefficients of the block 121 into the buffer 12. For example, FIG. 2A is a schematic diagram showing an inverse scan sequence after VLD 11 decodes the block 121. Please note that those decoded coefficients are lined from left to right firstly rather than from top to bottom. The VLD 11 performs an inverse scan function to respectively store the 0, 1, 2, 3 . . . 61, 62, 63 coefficients of the block 121 in the address 00h, 01h, 08h, 11h . . . 38h, 3Eh and 3Fh of the buffer 12 in the sequence of the arrow shown in the FIG. 2B.
In addition, FIGS. 2C to 2E demonstrate different sequences provided by commonly used inverse scan functions besides the aforementioned zigzag scan. For example, an inverse scan function may be implemented by following an alternately horizontal scan sequence (showed in the FIG. 2C) or an alternately vertical scan sequence (showed in the FIG. 2D) in MPEG-4, or it may be implemented with an inter macroblock zigzag scan sequence (showed in the FIG. 2E) in the DIVX-311 format. The VLD 11 is adaptive for the above inverse scan functions when storing the coefficients of the block 121 in the buffer 12 in response to the format of the block 121.
Please refer to FIG. 1 again, the DC/AC predictor 13 reads the block 121 from the buffer 12 in the address sequence. When the compressed media stream 111 is compressed based on the MPEG-1 or MPEG-2 standard, the DC/AC predictor 13 reads and outputs the block 121 directly so that the block 121 is applied to the IDCT or other further processing. However, when the compressed media stream 111 is compressed according to the MPEG-4 standard, what kind of the inverse scan function performed to the current block may depend on the previous block. Therefore, the DC/AC predictor 13 performs a DC/AC prediction to the block 121 so as to decide what kind of inverse scan functions is adaptive for the next block. Thereafter, the block 121 is outputted and performed to IDCT or other further processing.
However, when the buffer 12 stores data therein, the DC/AC predictor 13 cannot read any data from the buffer 12 at the same time. On the other hand, the buffer 12 still cannot perform any data-storing operation to the buffer 12 when the DC/AC predictor 13 reads data from the buffer 12. Consequently, the DC/AC predictor 13 and the buffer 12 must wait for each other to accomplish their current manipulating processes, and then activate associated read or store operation respectively.
It is therefore a subject of the invention to provide a decoding device and method, which alleviates the bottleneck caused by buffer unable to store and read data at the same time so as to improve the inverse scan performance during the decoding process.